﻿@model Cxuu.Models.AdminUser

@{
    ViewData["Title"] = await SystemConfig.GetByFieldNameAsync("SiteName");
}
<!doctype html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta name="author" content="Cdeng">
    <title>@ViewData["Title"]</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="~/lib/layui/css/layui.css">
    <link rel="stylesheet" href="~/admin/css/login.css">
</head>

<body>
    <div class="login layui-anim layui-anim-up">
        <div id="darkbannerwrap">@ViewData["Title"]</div>
        <div id="dvhide">
            <form method="post" class="layui-form">
                <div class="layui-form-item">
                    <input name="Username" placeholder="用户名" type="text" lay-verify="required" class="layui-input" value="">
                </div>
                <div class="layui-form-item">
                    <hr class="hr15">
                    <input name="Password" lay-verify="required" placeholder="密码" type="password" class="layui-input" value="">
                </div>
                @*<div class="layui-form-item">
                    <input type="checkbox" name="Remember" lay-skin="switch" checked>
                    <label class="layui-form-label">保持登录</label>
                </div>*@
                <div class="layui-form-item">
                    <hr class="hr15">
                    <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit" id="saveBtn">
                </div>
            </form>
        </div>

        <div class="message">用谷歌浏览器，IE就算了吧！<br />登录后，会持久登录7天！<br />如不需要持久登录，用完后请手动退出！</div>
       
    </div>
    
    <script src="~/lib/layui/layui.js" charset="utf-8"></script>
    <script>
        layui.define(function () {
            var form = layui.form, $ = layui.jquery;

            form.render;

            form.on('submit(login)', function (data) {
                data = data.field;

                data.Remember = "on"; //为了美观，把这里直接写死

                if (data.username == '') {
                    layer.msg('用户名不能为空', { icon: 2, anim: 6, time: 3000 });
                    return false;
                }
                if (data.password == '') {
                    layer.msg('密码不能为空', { icon: 2, anim: 6, time: 3000 });
                    return false;
                }

               var index = layer.load(2, { shade: [0.1, '#fff'] });
                $.post('/Admin/Login/Login', data, function (res) {
                    if (res.status == 1) {
                        $("#saveBtn").hide();
                        layer.msg(res.msg, { icon: 1, time: 1000 }, function () {
                            location.href = '/';// res.url;
                            layer.close(index);
                        });
                    } else {
                        layer.msg(res.msg, { icon: 2, anim: 6, time: 5000 });
                        layer.close(index);
                    }
                });
                return false;
            });
        });
    </script>
</body>
</html>